import {BANNER, NEWARRIVAL} from '../constants/home'
import {API_GOODS_PRODUCT} from '../constants/api'
import {createAction} from '../utils/redux'

/**
 * 分类菜单、列表
 * @param {*} payload
 */
export const dispatchBanners = (payload = {
  page: 1,
  size: 5,
  banner: 1,
  order: 'createTime',
  sort: 'desc',
  cateIds: '',
  status: 1
}) => createAction({
  url: API_GOODS_PRODUCT,
  type: BANNER,
  payload,
  fetchOptions: {
    delayTime: 300
  }
})


export const dispatchNewArrival = (payload = {
  page: 1,
  size: 20,
  banner: 0,
  order: 'createTime',
  sort: 'desc',
  cateIds: '',
  status: 1
}) => createAction({
  url: API_GOODS_PRODUCT,
  type: NEWARRIVAL,
  payload
})
